Skip to content

Mesheiks TDD Lab - RPGCharacter Object#8

Open
Mesheik wants to merge 2 commits intocode-differently:mainfrom
Mesheik:Mesheiks-branch
Open

Mesheiks TDD Lab - RPGCharacter Object#8
Mesheik wants to merge 2 commits intocode-differently:mainfrom
Mesheik:Mesheiks-branch

Conversation

@Mesheik
Copy link
Copy Markdown

@Mesheik Mesheik commented Mar 10, 2026

For this lab I created an RPGCharacter class representing a character in a role-playing game.

The class includes the following fields:

  • name
  • health
  • maxHealth
  • level
  • mana
  • alive

Custom methods implemented:

  • takeDamage()
  • heal()
  • levelUp()

These methods simulate common RPG mechanics like taking damage, healing, and leveling up.

The tests cover:

  • constructor validation
  • getters and setters
  • custom methods
  • edge cases
  • exception handling using assertThrows

JaCoCo Coverage: 82%

One challenge was making sure all validation branches were tested so the coverage would reach the required level.

@HeirJordan3
Copy link
Copy Markdown
Collaborator

Nice work on this submission. This is a strong object design with more than five fields, a constructor using all fields, getters and setters for each field, and multiple meaningful custom methods. Your tests are also clear and cover many of the main behaviors like taking damage, healing, leveling up, and updating fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants